import instance from '../util/request'
/**
 * 获取购物车列表
 * @returns  
 */
export const cart_list = (id)=>{ 
  return instance.get("/cart",{
    headers:{'Content-Type':'application/json'},
    params:{id}
  })
}

/**
 * 添加商品到购物车
 * id  商品id
 */
export const cart_add=(id,user_id,num)=>{
  return instance.post("/cart",{
    headers:{'Content-Type':'application/json'},
    data:{id,user_id,num}})
}
/**
 * 从购物车中移除商品
 */
export const cart_del=(id,user_id,c_num,num)=>{
  return instance.delete("/cart",{
    headers:{'Content-Type':'application/json'},
    params:{id,user_id,c_num,num}})
}
